import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

public class FastJson {
    public static void main(String[] args) {
        String jsonStr="{\"age\":22,\"clazz\":\"文科六班\",\"gender\":\"女\",\"id\":\"1500100001\",\"name\":\"施笑槐\"}";
    //直接获取age，别的不要了,将json字符串转换为json对象，直接获取值
//        JSONObject jsonObject = JSON.parseObject(jsonStr);
//        Object age = jsonObject.get("age");
//        System.out.println(age);
    //能不能转化为自定义student对象
        student jsonObject = JSON.parseObject(jsonStr,student.class);
        System.out.println(jsonObject.getAge());
        //把对象转化为json
        String s = JSON.toJSONString(jsonObject);
        System.out.println(s);
    }

}
